<?php 
class Zend_View_Helper_Sidebar extends Zend_View_Helper_Abstract
{
	private $_output = '';
	    
    public function sidebar()
    {
    	$dataCompany = new Nutri_Company_Institutional();
    	$resultCompany = $dataCompany->getDataCompany();
    	
    	$menu = new Nutri_Model_Menu();
		$resultMenu = $menu->fetchAll();
    	
    	foreach ($resultMenu as $menu) {
			$title = $menu->getTitle();
	    	switch (strtolower($title)) {
				case 'menu diario':
					$menuDiario = true;
					break;
				case 'menu semanal':
					$menuSemanal = $menu->getEnddate();
	    	}		
		}    	
    	
		$this->_output .= $this->tuPedido($resultCompany);  
			if(!empty($menuDiario)) {
				$this->_output .= $this->menuDia();
			}
			if(!empty($menuSemanal)) {
				$this->_output .= $this->menuSemanal($menuSemanal);	
			}
			$this->_output .= $this->promoDia();

		return $this->_output;
    }
    
    private function tuPedido($dataCompany)
    {
    	return $output = '<h3>Hac&eacute; tu pedido</h3>
        	<a class="asd-block asd-block-delivery">
        	   <img class="icn-delivery-phone" src="/images/site/asd-icn-phone.png" alt="Delivery: ' . $dataCompany['telefono'] . ' / ' . $dataCompany['celular'] . '" />
        	   <p id="asd-block-delivery-phone">' . $dataCompany['telefono'] . ' / ' . $dataCompany['celular'] . '</p>
            </a>
            <a class="asd-block asd-block-delivery" href="mailto:' . $dataCompany['email'] . '">
                <img src="/images/site/asd-icn-mail.png" alt="Delivery: ' . $dataCompany['email'] . '" />
                <p id="asd-block-delivery-mail">' . $dataCompany['email'] . '</p>
            </a>
            <a class="asd-block asd-block-facebook" href="' . $dataCompany['facebook'] . '" target="_blank">
                <img src="/images/site/asd-icn-facebook.png" alt="Visitanos en Facebook" />
                <p id="asd-block-facebook">Visita nuestro Facebook</p>
            </a>';
    }
    
	private function menuDia()
    {
    	return $output = '<h3>Men&uacute; del d&iacute;a</h3>
            <a id="asd-menudiario" href="/index/productos" class="asd-block clearfix">
                <p class="asd-block-infoextra">
                    <span class="asd-block-dateday">'. Nutri_Date_ShowDate::displayDayOfWeek() .'</span>
                    <span class="asd-block-datenum">'. Nutri_Date_ShowDate::displayNumberOfMounth() .'</span>
                </p>
                <p>Las opci&oacute;nes Nutrisimo de hoy para que disfrutes lo natural</p>
            </a>';
    }
    
	private function menuSemanal($dateWeek)
    {
    	return $output = '<h3>Men&uacute; semanal</h3>
            <a href="/index/productos" class="asd-block clearfix">
                <p class="asd-block-infoextra"><img src="/images/site/asd-icn-calendar.png" alt="Conoce el menu de esta semana" /></p>
                <p><strong>Entrega:</strong> <span class="delivery-semanal">'. Nutri_Date_ShowDate::displayDateMenu($dateWeek) .'</span><br />Conoc&eacute; el menu de esta semana</p>
            </a>';
    }
    
	private function promoDia()
    {
    	return $output = '<h3>Promos del d&iacute;a</h3>
            <a class="asd-block clearfix">
                <p class="asd-block-infoextra">$20</p>
                <p>Super sandwich de choclo + agua</p>
            </a>
            <a class="asd-block clearfix">
                <p class="asd-block-infoextra">$45</p>
                <p>Empanadas (la docena)</p>
            </a>';
    }
}